﻿@using STX.Domain
@model STX.Admin.Models.BizActivity.ItemErrorModel
@{
    Layout = null;
}

@if (Model.Step == StepEnum.制作报价 || Model.Step == StepEnum.制作成本 || Model.Step == StepEnum.财务经理制作成本
    || Model.Step == StepEnum.执行审核 || Model.Step == StepEnum.制作增减成本 || Model.Step == StepEnum.制作增减 || Model.Step == StepEnum.财务经理审核增减成本)
{
    if (Model.ActivityItem.ErrorStatus == BizActivityItem.ErrorStatusEnum.Error)
    {
        <div class="activityItemErrorFixed">
        <div class="activityItemErrorStatus"><input type="checkbox" name="BizActivityItems[@Model.ActivityItemIndex].ErrorStatus" value="@((int)BizActivityItem.ErrorStatusEnum.Correct)" />已修复</div>
        @if (!Model.ActivityItem.Comment.IsNullOrEmpty())
        {
            <div class="activityItemErrorStatusInfo" style="display: none">
                <h5><a href="javascript:void(0)" class="close">关闭</a></h5>
                <div>@Model.ActivityItem.Comment.Replace("\r\n", "<br/>")</div>
            </div>
         }
       </div>
    }
}
else
{
    <div class="activityItemErrorSetError">
    @if (Model.ActivityItem.ErrorStatus != BizActivityItem.ErrorStatusEnum.Error)
    {
            <div class="activityItemErrorStatus"><input type="checkbox" name="BizActivityItems[@Model.ActivityItemIndex].ErrorStatus" value="@((int)BizActivityItem.ErrorStatusEnum.Error)" />有问题</div>
            <div class="activityItemErrorStatusInfo"  style="display: none">
                <h5><a href="javascript:void(0)" class="close">关闭</a></h5>
                @if (!Model.ActivityItem.Comment.IsNullOrEmpty())
                {
                    <div>@Model.ActivityItem.Comment.Replace("\r\n", "<br/>")</div>
                }
                <textarea style="width:500px; height: 130px;" name="BizActivityItems[@Model.ActivityItemIndex].Comment"></textarea>
            </div>
    }
    </div>
}

@if (Model.ActivityItemCount == Model.ActivityItemIndex + 1)
{
    <style type="text/css">
        .activityItemErrorFixed,.activityItemErrorSetError{ position: relative;}
        .activityItemErrorStatusInfo{ position: absolute; top: 0; right: 90px;padding: 10px; width: 500px; height: 200px;
            border: #ffa500 1px solid;overflow: auto;
            background: #ffe4b5;}
        .activityItemErrorStatusInfo .close{ float: right;}
    </style>
    <script type="text/javascript">
        $(function() {
            $(".activityItemErrorSetError input[name*='ErrorStatus']").click(function () {
                var $this = $(this);
                if ($this.attr("checked")) {
                    $this.parent().parent().find(".activityItemErrorStatusInfo").show();
                } else {
                    $this.parent().parent().find(".activityItemErrorStatusInfo").hide();
                }
            });
            $(".activityItemErrorFixed").hover(function() {
                var $this = $(this);
                $this.find(".activityItemErrorStatusInfo").show();
            },function() {
                var $this = $(this);
                $this.find(".activityItemErrorStatusInfo").hide();
            });
            $(".activityItemErrorStatusInfo .close").click(function() {
                $(this).parent().parent().hide();
            });
        });
    </script>
}